package view.items;

import java.awt.Dimension;

import javax.swing.Icon;
import javax.swing.JButton;

import view.BaseComponent;

// This is the basic item abstract class all
// the actual items will extend :

public abstract class ItemPanel extends BaseComponent {
	protected JButton addButton;
	protected JButton delButton;
	
	public ItemPanel() {
		addButton = new JButton("+");
		delButton = new JButton("-");
		
		addButton.setMaximumSize(new Dimension(20,20));
		delButton.setMaximumSize(new Dimension(20,20));
		
		addButton.setMinimumSize(new Dimension(20,20));
		delButton.setMinimumSize(new Dimension(20,20));
	}
	
	public void setAddIcon(Icon icon) {
		addButton.setIcon(icon);
		addButton.setText("");
		if (icon.getIconWidth()>0 && icon.getIconHeight()>0)
			addButton.setPreferredSize(new Dimension(icon.getIconWidth(),icon.getIconHeight()));
	}
	
	public void setDelIcon(Icon icon) {
		delButton.setIcon(icon);
		delButton.setText("");
		if (icon.getIconWidth()>0 && icon.getIconHeight()>0)
			delButton.setPreferredSize(new Dimension(icon.getIconWidth(),icon.getIconHeight()));
	}
}
